import { createRouter, createWebHistory } from "vue-router";

//路由懒加载
const Home = () => import('@views/home/Home')
const Category = () => import('@views/category/Category')
const Cart = () => import('@views/cart/Cart')
const Profile = () => import('@views/profile/Profile')
const Detail = () => import('@views/detail/Detail')

const routes = [
  {
    path:'/',
    redirect:'/home'
  },
  //主页
  {
    path:'/home',
    name:'Home',
    component:Home,
  },
  //分类
  {
    path:'/category',
    name:'Category',
    component:Category
  },
  //商品
  {
    path:'/cart',
    name:'Cart',
    component:Cart
  },
  //我的
  {
    path:'/profile',
    name:'Profile',
    component:Profile
  },
  //详情页面
  {
    path:'/detail/:id',
    name:Detail,
    component:Detail
  }
];


const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
});

export default router;
